
package com.segment.dcore.base.filter;

import java.util.Iterator;
import java.util.List;

/**
 * Filter调用链
 *
 * Created by huapeng.hhp on 2017/2/27.
 */
public class FilterChain {
	/** Filter调用链 */
	private Iterator<ServiceFilter> filterIter;

	/**
	 * 过调用链
	 * 
	 * @param invokeContext
	 *            调用上下文
	 */
	public void doFilter(InvokeContext invokeContext) {
		if (filterIter.hasNext()) {
			filterIter.next().doFilter(this, invokeContext);
		}
	}

	/**
	 * Filter调用链构造函数
	 * 
	 * @param filterList
	 *            filter列表
	 */
	public FilterChain(List<ServiceFilter> filterList) {
		filterIter = filterList.iterator();
	}
}
